const fp = require('lodash/fp');
const { Maybe,Container } = require('./support')

let maybe = Maybe.of([5,6,1])
let ex1 = (param) =>{
    let f1 = maybe.map(fp.map(fp.add(param)))
    console.log(f1)
}
ex1(5)

let xs = Container.of(['do','ray','me','fa','so'])
let ex2 = (result) => {
    let f1 = xs.map(fp.first)
    console.log(f1)
}
ex2()

let safeProp = fp.curry(function (x,o)
{
return Maybe.of(o[x])
})
let user = {id:2,name:'Albert'}

let ex3 = (prop,param)=>{
    let f1 = safeProp(prop,param).map(fp.first)
    console.log(f1)
}
ex3('name',user)

let ex4 = function (n) {
    return Maybe.of(n).map(parseInt);
}
let data = ex4(3);
console.log(data)